//
//  FRQDealerSupportViewController.m
//  FRQBluetoothKit_Example
//
//  Created by admin on 2023/11/16.
//  Copyright © 2023 xuchunhai. All rights reserved.
//

#import "FRQDealerSupportViewController.h"
#import "DealerSupportViews.h"
@interface FRQDealerSupportViewController ()
@property (nonatomic,strong) DealerSupportViews *DealerSupportView;
@end

@implementation FRQDealerSupportViewController

- (DealerSupportViews *)DealerSupportView{
    if (nil==_DealerSupportView) {
        _DealerSupportView=skXibView(@"DealerSupportViews");
        [self.view addSubview:_DealerSupportView];
        
        [_DealerSupportView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.mas_topLayoutGuide);
            make.bottom.mas_equalTo(self.mas_bottomLayoutGuide);
            make.right.left.mas_equalTo(0);
        }];
        @weakify(self)
        [[_DealerSupportView.btnBack rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self)
            [self dismissViewControllerAnimated:YES completion:^{
                
            }];
        }];
        _DealerSupportView.txtName.text=skUser.name;
        _DealerSupportView.txtEmail.text=skUser.accountNo;
        
        [[_DealerSupportView.btnSend rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self)
            [self appUserNeedSupport];
        }];
    }
    return _DealerSupportView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.DealerSupportView.hidden=NO;
    // Do any additional setup after loading the view.
}
-(void)appUserNeedSupport{
    NSString *title=[NSString stringWithFormat:@"%@",self.DealerSupportView.txtPhoneNumber.text];
    
    NSString *message=[NSString stringWithFormat:@"%@",self.DealerSupportView.txtMessage.text];
    
    NSDictionary *dic=@{@"phoneNumber":title,
                        @"message":message
    };
    [skNetTools skPOSTWithURL:[NSString stringWithFormat:@"%@%@",skURL,@"app/user/need/support"] parameters:dic cachePolicy:0 callback:^(id  _Nonnull responseObject, NSError * _Nonnull error) {
        NSLog(@"数据=%@",responseObject);
        skNetModel *model=responseObject;
        
        [SkToast SkToastShow:model.msg];
    }];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
